<?php	
	error_reporting(E_ALL^E_NOTICE);
	require_once ('./config/config.php'); 
	require_once ('./class/email.class.php'); 
	require_once ('./class/tools.class.php');
	date_default_timezone_set("PRC");
	session_start();
	if(!empty($_SESSION['user'])){
		echo "<script>location='./index.php';</script>";
		exit();
	}else{
		if($_GET['user'] && $_GET['key']){
			$userRs=mysqli_fetch_array(mysqli_query($con,"select * from user where user='".$_GET['user']."'"));
			$key=sha1($userRs['time']);
			if($key==$_GET['key']){
				if($userRs['state']=="0"){
					mysqli_query($con,"UPDATE `user` SET `state` = '1' WHERE `user`='".$_GET['user']."'");
					echo "<script>alert('激活成功！');location='./login.php';</script>";
					exit();
				}else{
					exit('erro:无法激活!');
				}
			}else{
				echo "<script>alert('激活失败！');</script>";
				exit('erro:激活失败!');
			}
		}else{
			exit('erro:激活失败!');
		}
	}
?>